At the heart of the common controls in Android are two classes:android.view.Viewandroid.view.ViewGroupThe View class represents a general-purpose View object. The common controls in Android ultimately extend the View class.ViewGroup is a view and it contains other views. ViewGroup is the base class for a list of layout classes.LayoutAndroid uses the concept of layouts to manage how controls are laid out within a container view.You can choose from several approaches to build UIs in Android.You can construct UIs entirely in code.You can also define UIs in XML.You can even combine the two-define the UI in XML and then refer to it, and modify it, in code.Common Layout attributesEach View and ViewGroup has a set of common attributes.layout_width specifies the width of the View or ViewGrouplayout_height specifies the height of the View or ViewGrouplayout_marginTop specifies extra space on the top side of the View or ViewGrouplayout_marginBottom specifies extra space on the bottom side of the View or ViewGrouplayout_marginLeft specifies extra space on the left side of the View or ViewGrouplayout_marginRight specifies extra space on the right side of the View or ViewGrouplayout_gravity specifies how child Views are positionedlayout_weight specifies how much of the extra space in the layout should be allocated to the Viewlayout_x specifies the x-coordinate of the View or ViewGrouplayout_y specifies the y-coordinate of the View or ViewGroupNoteThe layout_weight and layout_gravity att
برچسب:
نویسنده: دانیال باقری
تاريخ: جمعه
26 اسفند
1401 ساعت: 18:46